import Vue from 'vue';
import app from './App.vue';
import Mint from 'mint-ui';
import vueResource  from 'vue-resource'
import 'mint-ui/lib/style.css';
import './static/css/style.css'
import './static/mui/css/mui.css'
import './static/mui/fonts/mui.ttf'

import vueRouter from 'vue-router'
import category from './component/category/category.vue'
import home from './component/home/home.vue'
import mine from './component/mine/mine.vue'
import shopcart from './component/shopcart/shopcart.vue'
import newsList from './component/news/news.vue';
import moment from 'moment'
import details from './component/newsDetails/details.vue'
import photo from './component/poto/poto.vue'
import photoInfo from './component/photoinfo/photoinfo.vue'
import VuePreview from 'vue-preview'

Vue.filter('fmtDate',function(input,fmtDateSring){
    const lastFormatString = fmtDateSring || 'YYYY-MM-DD HH:mm:ss'
    return moment(input).format(lastFormatString)
})

Vue.use(VuePreview)
Vue.use(Mint);
Vue.use(vueRouter);
Vue.use(vueResource);

const router = new vueRouter({
    routes:[
        {path:'/',redirect:'/home'},        
        {path:'/home',component:home},
        {path:'/category',component:category},
        {path:'/mine',component:mine},
        {path:'/shopcart',component:shopcart},
        {path:'/news/list',component:newsList},
        {path:'/news/news/list/:newsid',component:details},
        {path:'/photo',component:photo},
        {path:'/photo/photoinfo/:photoId',component:photoInfo}
    ]
})

new Vue({
    el:'#app',
    render:function(createElement){
        return createElement(app)
    },
    router
})